import { axios } from '~/plugins/axios';

export const login = (params: any) => axios({
  method: 'post',
  url: '/admin/ec_login',
  data: params,
}) as Promise<any>;

export const logout = () => axios({
  method: 'get',
  url: '/admin/Loginout',
}) as Promise<unknown>;

// 注册
export const register = (params: any) => axios({
  method: 'post',
  url: '/admin/register',
  data: params,
}) as Promise<any>;

// 发送邮件
export const sendEmail = (params: any) => axios({
  method: 'post',
  url: '/EmailController/send',
  data: params,
}) as Promise<any>;

// 校验验证码是否正确
export const checkCode = (params: any) => axios({
  method: 'get',
  url: '/EmailController/checkCode',
  params,
}) as Promise<any>;

// 重置密码
export const reset = (params: any) => axios({
  method: 'post',
  url: '/admin/resetPassword',
  data: params,
}) as Promise<any>;

// 机构类型
export const orgType = () => axios({
  method: 'get',
  url: '/dict/orgType',
}) as Promise<any>;

// 首页新闻列表
export const newsList = (params?: any) => axios({
  method: 'get',
  url: '/admin/newsList',
  params,
}) as Promise<any>;

// 首页会议列表
export const eventsList = (params?: any) => axios({
  method: 'get',
  url: '/admin/homeEvents',
  params,
}) as Promise<any>;

// 首页国际经验列表
export const expList = (params?: any) => axios({
  method: 'get',
  url: '/admin/expList',
  params,
}) as Promise<any>;

// 首页政策列表
export const policyList = (params?: any) => axios({
  method: 'get',
  url: '/admin/policyList',
  params,
}) as Promise<any>;

// 新闻详情
export const newsDetail = (params?: any) => axios({
  method: 'get',
  url: `/dynamiNews/detail/${params as string}`,
}) as Promise<any>;

// 政策详情
export const policyDetail = (params?: any) => axios({
  method: 'get',
  url: `/policy/detail/${params as string}`,
}) as Promise<any>;

// 国际经验详情
export const expDetail = (params?: any) => axios({
  method: 'get',
  url: `/international_exp/detail/${params as string}`,
}) as Promise<any>;

// 会议详情
export const eventsDetail = (params?: any) => axios({
  method: 'get',
  url: `/events/detail/${params as string}`,
  data: params,
}) as Promise<any>;
